import { Module } from "@nestjs/common";
import { TypeOrmModule } from "@nestjs/typeorm";
import { ChatModule } from "./chat/chat.module";
import { AuthModule } from "./auth/auth.module";
import { UsersModule } from "./users/users.module";
import * as dotenv from "dotenv";
dotenv.config();
@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: "mysql" as any,
      host: process.env.DB_HOST || "127.0.0.1",
      port: Number(process.env.DB_PORT || 3306),
      username: process.env.DB_USERNAME || "root",
      password: process.env.DB_PASSWORD || "",
      database: process.env.DB_DATABASE || "chat_db",
      synchronize: true,
      autoLoadEntities: true,
      entities: [__dirname + "/**/*.entity.{ts,js}"],
    }),
    AuthModule,
    UsersModule,
    ChatModule,
  ],
})
export class AppModule {}
